package cn.dengta.webapp.user.form;

import cn.dengta.common.validator.Form;
import cn.dengta.webapp.base.entity.BaseEntity;
import lombok.*;
import lombok.experimental.Accessors;

@Getter
@Setter
@Accessors(chain = true)
public class AddVipTimeForm implements Form {

	private static final long serialVersionUID = 1L;

	/** 用户ID */
	public Long userId;
	/** VIP配置id */
	public Long vipConfigId;
	/** 增加的 VIP 天数（为负数表示扣除） */
	public Integer addDays;
	/** 操作的目标类型 */
	private String assocType;
	/** 操作的目标ID */
	private Long assocId;
	/* 低于3.1.0的即为老版本 */
	private boolean oldVersion;
	/** 赠送VIP */
	@Setter(AccessLevel.NONE)
	public boolean forGift;

	public AddVipTimeForm init(Long userId, Integer addDays, String assocType, Long assocId) {
		this.userId = userId;
		this.addDays = addDays;
		this.assocType = assocType;
		this.assocId = assocId;
		return this;
	}

	public AddVipTimeForm init(Long userId, Integer addDays, BaseEntity assocObj) {
		return init(userId, addDays, assocObj.entityName(), assocObj.getId());
	}

}
